var findMedianSortedArrays = function (nums1, nums2) {
  let arr = [...nums1, ...nums2]
  arr = arr.sort((a,b)=>a-b)
  console.log(arr);
  let len = arr.length % 2
  let index = Math.round(arr.length / 2)
  if (len == 0) {
    let res = (arr[index] + arr[index - 1]) / 2
    return res
  } else {
    return arr[index - 1]
  }
};
console.log(findMedianSortedArrays([1, 2, 30],[5]));